package Day06;

import java.lang.invoke.SwitchPoint;
import java.util.Scanner;

public class Text2 {
    public static void main(String[] args) {


        Scanner scan = new Scanner(System.in);

        System.out.println("---------------家庭收入记账软件---------------\n");
        System.out.println("            (1)收入明细" + "\n" + "             (2)登记收入" + "\n" + "             (3)登记支出" + "\n" + "             (2)退出\n");
        System.out.print("\t\t\t\t请选择(1-4):");

        int i;  //选择操作;
        int sum=1000;
        boolean flag = true;
        String s ="";
        String s2 = "";
        String s3 = "收支     "+"账户金额"+"           "+"收支金额"+"             "+"说明";

        while (flag){
            flag= false;
            i = scan.nextInt();
            int a=i;
            switch (a) {
                case 1:
                    flag = true;
                    System.out.println("---------------家庭收入记账软件---------------\n");

                    System.out.println(s3);
                    System.out.println(s);
                    System.out.println(s2);

                    System.out.println("请输出新的操作");
                    break;
                case 2:
                    flag = true;
                    System.out.println();
                    System.out.print("本次收入金额:");
                    Double n = scan.nextDouble();
                    sum += n;
                    System.out.print("本次收入说明:");
                    String ss = scan.next();
                    s = s+"\n"+ "收入     "+sum+"             "+n+"           "+ss;
                    System.out.println("请输出新的操作");
                    break;
                case 3:
                    flag = true;
                    System.out.println();
                    System.out.println("本次支出金额:");
                    int b = scan.nextInt();
                    sum -= b;
                    System.out.println("本次支出说明:");
                    String sss = scan.next();
                    s2 = s2+"\n"+"支出    "+sum+"             "+b+"           "+sss;
                    System.out.println("请输出新的操作");
                    break;
                case 4:
                    flag = true;
                    System.out.println("请确认是否退出(Y/N):");
                    String z = scan.next();
                    if (z.equals("Y")){
                        System.out.println("您已退出系统");
                        flag = false;
                        break;
                    }else if (z.equals("N")){
                        System.out.println("请输入接下来的操作:");
                    }

                    break;
                default:
                    System.out.println("请输入正确的操作");
                    break;
            }
        }
    }

}



